package com.scrawler.vo;

import org.apache.commons.lang.StringUtils;
import org.htmlparser.NodeFilter;
import org.htmlparser.filters.HasAttributeFilter;
import org.htmlparser.filters.OrFilter;

import com.scrawler.html.template.ParseTools;

public class NewsContentConfig {

	private int  typeId;
	private String website_name;
	private String encoding;
	
	
	private String title;
	private String author;
	private String content;
	private String hits;
	private String comments;
	private String pub_time;
	
	public int getTypeId() {
		return typeId;
	}
	public void setTypeId(int typeId) {
		this.typeId = typeId;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getAuthor() {
		return author;
	}
	public void setAuthor(String author) {
		this.author = author;
	}
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
	public String getHits() {
		return hits;
	}
	public void setHits(String hits) {
		this.hits = hits;
	}
	public String getComments() {
		return comments;
	}
	public void setComments(String comments) {
		this.comments = comments;
	}
	public String getPub_time() {
		return pub_time;
	}
	public void setPub_time(String pub_time) {
		this.pub_time = pub_time;
	}
	public String getWebsite_name() {
		return website_name;
	}
	public void setWebsite_name(String website_name) {
		this.website_name = website_name;
	}
	public String getEncoding() {
		return encoding;
	}
	public void setEncoding(String encoding) {
		this.encoding = encoding;
	}
	
	public NodeFilter[] getFilters(){
		NodeFilter []filters = new NodeFilter[6];
		if(!StringUtils.isEmpty(title)){
			filters[0] = ParseTools.splitFilterStr(title);
		}else{
			filters[0] = new OrFilter();
		}
		
		if(!StringUtils.isEmpty(author)){
			filters[1] = ParseTools.splitFilterStr(author);
		}else{
			filters[1] = new OrFilter();
		}
		
		if(!StringUtils.isEmpty(content)){
			filters[2] = ParseTools.splitFilterStr(content);
		}else{
			filters[2] = new OrFilter();
		}
		
		if(!StringUtils.isEmpty(hits)){
			filters[3] = ParseTools.splitFilterStr(hits);
		}else{
			filters[3] = new OrFilter();
		}
		
		if(!StringUtils.isEmpty(comments)){
			filters[4] = ParseTools.splitFilterStr(comments);
		}else{
			filters[4] = new OrFilter();
		}
		
		if(!StringUtils.isEmpty(pub_time)){
			filters[5] = ParseTools.splitFilterStr(pub_time);
		}else{
			filters[5] = new OrFilter();
		}
		

		return filters;
	}
	
	
	
	
}
